home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGIALS / PTUTOR2B.LZH / RECURSON.PAS < prev    next >
Pascal/Delphi Source File  |  1988-01-15  |  409b  |  18 lines

  1.                                 (* Chapter 5 - Program 7 *)
  2. program Try_Recursion;
  3.  
  4. var Count : integer;
  5.  
  6. procedure Print_And_Decrement(Index : integer);
  7. begin
  8.    Writeln('The value of the index is ',Index:3);
  9.    Index := Index - 1;
  10.    if Index > 0 then
  11.       Print_And_Decrement(Index);
  12. end;
  13.  
  14. begin  (* main program *)
  15.    Count := 7;
  16.    Print_And_Decrement(Count);
  17. end.  (* main program *)
  18.